package com.wbt.bambootown.ui.activity;

import android.support.design.widget.TextInputEditText;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.gyf.barlibrary.ImmersionBar;
import com.wbt.bambootown.BuildConfig;
import com.wbt.bambootown.FrameApp;
import com.wbt.bambootown.R;
import com.wbt.bambootown.cons.Cons;
import com.wbt.bambootown.utils.EventCenter;
import com.wbt.bambootown.utils.SPUtils;

import butterknife.BindView;
import butterknife.OnClick;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;

public class SetAddressActivity extends BaseActivity {
    @BindView(R.id.edit_address)
    TextInputEditText mEditAddress;

    @Override
    public void initStatusBar(ImmersionBar immersionBar) {
        immersionBar
                .fitsSystemWindows(true)
                .init();
    }

    @OnClick(R.id.btn_next)
    public void onClick(){
        String address = mEditAddress.getText().toString().trim();
        if (address.isEmpty()) {
            mEditAddress.setError("地址不能为空");
        } else {
            mEditAddress.setError(null);
            SPUtils.putBoolean(Cons.SPCons.IS_FIRST , false);
            SPUtils.putString(Cons.SPCons.API_ADDRESS , address);
            FrameApp.btnSetGlobalUrl(address);
            startActivity(LoginActivity.class);
        }
    }

    @Override
    public void initView() {

    }

    @Override
    public void initData() {

    }

    @Override
    public Object getContentView() {
        return R.layout.activity_set_address;
    }

    @Override
    public boolean isApplyEventBus() {
        return false;
    }

    @Override
    public boolean isApplyButterKnife() {
        return true;
    }

    @Override
    public void onEventCome(EventCenter eventCenter) {

    }
}
